<template>
	<view class="wrap">
		<view class="top"></view>
		<view class="content">
			<template v-if="action==='delivery'">
				<view class="title">配货完成<image style="width:82rpx;height:42rpx;" src="/static/images/arrow-r.png"></image>发货/配送</view>
				<input class="u-border-bottom" type="tel" v-model="payment_id" placeholder="请输入订单查询码(订单号后几位)" />
				<view class="tips">订单流水号：年月日-当日订单数-订单查询码</view>
				<button @tap="queryPayment" :style="[inputPaymentId]" class="getCaptcha">查询订单</button>
			</template>
			<template v-if="action==='verify'">
				<view class="title">验提货码<image style="width:82rpx;height:42rpx;" src="/static/images/arrow-r.png"></image>完成提货</view>
				<input class="u-border-bottom" type="text" v-model="pickup_code" placeholder="请输入提货码" />
				<!-- <view class="tips">订单流水号：年月日-当日订单数-订单查询码</view> -->
				<br>
				<button @tap="queryPayment" :style="[inputPickupCode]" class="getCaptcha">查询提货码</button>
			</template>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				buttonText: '',
				action: '',
				payment_id: '',
				pickup_code: ''
			}
		},
		computed: {
			inputPaymentId() {
				let style = {};
				if (this.payment_id) {
					style.color = "#fff";
					style.backgroundColor = this.$u.color['warning'];
				}
				return style;
			},
			inputPickupCode() {
				let style = {};
				if (this.pickup_code) {
					style.color = "#fff";
					style.backgroundColor = this.$u.color['warning'];
				}
				return style;
			}
		},
		onLoad(options) {
			this.action = options.action;
			if (options.action === 'delivery') {} else if (options.action === 'verify') {}
		},
		methods: {
			queryPayment() {
				if (this.action === 'delivery') {
					if(!this.payment_id){
						uni.showToast({
							title: '请输入订单号未尾的查询码',
							icon: 'none'
						});
						return false;
					}
					this.$u.route({
						type: 'to',
						params: {
							payment_id: this.payment_id
						},
						url: '/pages/ucp/store-manage/order-ucp-delivery',
						animationType: 'slide-in-bottom'
					});
					return;
				}
				if (this.action === 'verify') {
					if(!this.pickup_code){
						uni.showToast({
							title: '请输入提货码',
							icon: 'none'
						});
						return false;
					}
					this.$u.route({
						type: 'to',
						params: {
							pickup_code: this.pickup_code
						},
						url: '/pages/ucp/store-manage/order-ucp-confirm',
						animationType: 'slide-in-bottom'
					});
					return;
				}
				if (this.action === 'query') {
					this.$u.route({
						type: 'to',
						params: {
							payment_code: this.payment_id
						},
						url: '/pages/ucp/store-manage/order-ucp-query',
						animationType: 'slide-in-bottom'
					});
					return;
				}
			}

		}
	}
</script>
<style lang="scss" scoped>
	.wrap {
		font-size: 28rpx;
		background-color:#fff;
		padding: 40rpx;
		margin: 20rpx;
		border-radius: 4px;

		.content {
			width: 600rpx;
			margin: 80rpx auto 0;

			.title {
				text-align: left;
				font-size: 50rpx;
				font-weight: 500;
				margin-bottom: 100rpx;
				text-align: center;
			}

			input {
				text-align: left;
				margin-bottom: 10rpx;
				padding-bottom: 6rpx;
			}

			.tips {
				color: $u-type-info;
				margin-bottom: 60rpx;
				margin-top: 8rpx;
			}

			.getCaptcha {
				background-color: rgb(253, 243, 208);
				color: $u-tips-color;
				border: none;
				font-size: 30rpx;
				padding: 12rpx 0;

				&::after {
					border: none;
				}
			}

			.alternative {
				color: $u-tips-color;
				display: flex;
				justify-content: space-between;
				margin-top: 30rpx;
			}
		}

		.buttom {
			.loginType {
				display: flex;
				padding: 350rpx 150rpx 150rpx 150rpx;
				justify-content: space-between;

				.item {
					display: flex;
					flex-direction: column;
					align-items: center;
					color: $u-content-color;
					font-size: 28rpx;
				}
			}

			.hint {
				padding: 20rpx 40rpx;
				font-size: 20rpx;
				color: $u-tips-color;

				.link {
					color: $u-type-warning;
				}
			}
		}

		.payment-info {
			background-color: #FFF;
			padding: 0 30rpx 30rpx 30rpx;
			border-radius: 10rpx;
			box-sizing: border-box;
			margin-bottom: 30rpx;

			.bold {
				font-weight: bold;
				border-bottom: 1rpx solid #c9c8d2;
			}

			.calculation-data {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				padding-top: 30rpx;
				// margin-bottom: 10rpx;

				.data-title {
					width: 6em;
					font-weight: bold;
				}

				.data-text {
					flex: 1
				}
			}

		}
	}
</style>
